package com.snowy.hidden.biz.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 审核状态枚举
 * @author hjl
 */
@Getter
@AllArgsConstructor
public enum AssignmentStatusEnum {
    //待指派
    WAIT_ASSIGN(0,"待指派"),
    //已指派
    ASSIGNED(1,"已指派"),
    UNKNOW(99,"未知"),
    ;

    /**
     * 值
     */
    private Integer value;
    /**
     * 描述
     */
    private String desc;

    public static AssignmentStatusEnum findByValue(Integer val) {
        return Arrays.stream(AssignmentStatusEnum.values()).filter(item -> Objects.equals(val, item.getValue())).findFirst().orElse(UNKNOW);
    }

    public static String getNameByValue(Integer val) {
        return Arrays.stream(AssignmentStatusEnum.values()).filter(item -> Objects.equals(val, item.getValue())).findFirst().orElse(UNKNOW).getDesc();
    }
}
